﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using RuleCode.Table;

namespace map.member
{
    public partial class configshop_curpath : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                setbackcolor();
                setposition();
            }
        }
        private void setbackcolor()
        {
            if (this.Request.Params["cbshoppageid"] != null)
            {
                cbuser u = cbuser.getcuruser();
                cbshopcss sc = cbshopcss.findorcreate(u.cbuserid.ToString());
                cbshoppage sp = cbshoppage.Find(" cbshoppageid = '"
                + cbshop.transhoppageid(this.Request.Params["cbshoppageid"].ToString())
                + "' and cbuserid = '" + u.cbuserid.ToString() + "'"
                );
                string backcolour = sp.backcolour.ToString();
                if (backcolour == "")
                {
                    backcolour = sc.alltablecolor.ToString();
                }
                if (backcolour == "")
                {
                    backcolour = sc.allbackcolor.ToString();
                }
                if (backcolour == "")
                {
                    backcolour = "#FFFFFF";
                }
                string back = "<script type =\"text/javascript\" >setbackcolor('" + backcolour + "');</script>";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                    "zback", back, false);
            }
        }
        private void setposition()
        {
            if (this.Request.Params["cbshoppageid"] != null)
            {
                Label_cur.Text = "当前页面：" 
                    + cbshop.transhoppageid(this.Request.Params["cbshoppageid"].ToString());
                if (this.Request.Params["cbshoppageid"].ToString() == "1")
                {
                    string cataid = "";
                    if (this.Request.Params["itemcataid"] != null)
                    {
                        cataid = this.Request.Params["itemcataid"].ToString();
                        taobaoItemCat ic = taobaoItemCat.Find("taobaocid ='" + cataid + "'");
                        Label_cur.Text += " - " + ic.taobaoname.ToString();
                    }  
                }
                if (this.Request.Params["cbshoppageid"].ToString() == "2")
                {
                    string itemid = "";
                    if (this.Request.Params["itemid"] != null)
                    {
                        itemid = this.Request.Params["itemid"].ToString();
                        taobaouseritems ui = taobaouseritems.Find(" recid =  " + itemid);
                        Label_cur.Text += " - " + ui.taobaotitle.ToString();
                    }
                }
                if (this.Request.Params["cbshoppageid"].ToString() == "5")
                {
                    string cataid = "0";
                    if (this.Request.Params["value"] != null)
                    {
                        cataid = this.Request.Params["value"].ToString();
                        cbcata c = cbcata.Find(" cbcataid = '" + cataid + "' ");
                        Label_cur.Text += " - " + c.cbname.ToString();
                    }
                }
                if (this.Request.Params["cbshoppageid"].ToString() == "6")
                {
                    string id = "0";
                    if (this.Request.Params["value"] != null)
                    {
                        id = this.Request.Params["value"].ToString();
                    }
                    cblist l = cblist.Find("cblistid='" + id + "'");
                    Label_cur.Text += " - " + l.cbtitle.ToString();
                }
            }
            
        }
    }
}
